﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
using devtm.Aop.Emit;
using devtm.Aop.InternalProcess;
using System.Reflection;
using devtm.Aop.Convert;
using devtm.Aop.Event;
using devtm.Aop.Linq.Boxs;
using devtm.Aop;
using devtm.Aop.Extensions;

namespace devtm.Aop.Linq
{


    public class GroupMethod
    {

        internal HashSet<MethodSign> Methods = new HashSet<MethodSign>();
        internal Dictionary<Type, IInterceptor> Interceptors = new Dictionary<Type, IInterceptor>();
        protected string label;
        internal Proxy parent;


        public GroupMethod Select(params System.Reflection.MethodInfo[] methods)
        {
            methods.NotNull("predicate");
            RegisterSignatures(methods.Select(m => m.ExtractMethodSignature()));
            return this;
        }        


        #region Private Methods

        internal IEnumerable<MethodSign> RegisterSignatures(IEnumerable<MethodSign> signatures)
        {
            foreach (var signature in signatures)
                if (!Methods.Contains(signature))
                    Methods.Add(signature);

            return signatures;

        }

        #endregion

    }



}
